<?php

namespace Usap\Model\Account;

use Usap\Model\BaseModel;
use Usap\Service\Service;

class UserModel extends BaseModel
{
    //数据源配置
    public function _initialize()
    {
        $this->connection = C('db_pool.admin');
        $this->trueTableName = 'user';
    }



    public function verifyUserName($userName)
    {
        $strLen = utf8_strlen($userName);
        if (preg_match('/^[0-9a-zA-Z_\x{4e00}-\x{9fa5}]+$/u', $userName) && $strLen <= 16 && $strLen >= 2) {
            return true;
        } else {
            $this->error = '请使用2-16位数字、字母、下划线或者汉字';
            return false;
        }
    }


}
